#include <iostream>
#include <string>

#include "Debug.h"

#ifndef DBG_LEVEL
#define DBG_LEVEL DBG_LV_FATAL
#endif

void
DebugMsg::errMsgOut( DBG_LV level, const char *class_name,
		const char *member_name, const char *msg )
{
	std::string dbg_level;

	if( (level > DBG_LV_FATAL) && (level > DBG_LEVEL) )
		return;

	if( level <= DBG_LV_FATAL ){
		dbg_level = "FATAL!";
	}
	else if( level == DBG_LV_NORMAL ){
		dbg_level = "NORMAL";
	}
	else if( level == DBG_LV_MINOR ){
		dbg_level = "MINOR";
	}
	else{
		dbg_level = "NOTHING";
	}

	std::cerr << "** " << dbg_level << " ** " <<"In " << class_name
		<< "::" << member_name << " : " << msg << std::endl;
}

void
DebugMsg::errMsgOut( DBG_LV level, const char *func_name,
		const char *msg )
{
	std::string dbg_level;

	if( (level > DBG_LV_FATAL) && (level > DBG_LEVEL) )
		return;

	if( level <= DBG_LV_FATAL ){
		dbg_level = "FATAL!";
	}
	else if( level == DBG_LV_NORMAL ){
		dbg_level = "NORMAL";
	}
	else if( level == DBG_LV_MINOR ){
		dbg_level = "MINOR";
	}
	else{
		dbg_level = "NOTHING";
	}

	std::cerr << "** " << dbg_level << " ** " <<"In " << func_name
		<< " : " << msg << std::endl;
}
